package com.asset.salesforce.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.asset.salesforce.dao.AppointmentDaoImpl;
import com.asset.salesforce.domain.Appointment;

@Service
@Transactional(readOnly=true)
public class AppointmentService {
	@Autowired
	private AppointmentDaoImpl appointmentDaoImpl;
	
	@Transactional(readOnly = false)
	public void addAppointment(Appointment appointment){
		appointmentDaoImpl.add(appointment);
	}
	@Transactional(readOnly = true)
	public Appointment getAppointmentById(Appointment appointment,Integer id){
		return appointmentDaoImpl.getById(id, appointment);
	}
	@Transactional(readOnly = true)
	public List<Appointment> getAllAppointment(Appointment appointment){
		return appointmentDaoImpl.getAll(appointment);
	}
	@Transactional(readOnly = true)
	public List<Appointment> getAppointmentByParentId(Integer parentId, String parentType){
		return appointmentDaoImpl.getAppointmentByParentId(parentId, parentType);
	}
	@Transactional(readOnly = false)
	public void saveOrUpdate(Appointment appointment){
		appointmentDaoImpl.saveOrupdate(appointment);
	}
	@Transactional(readOnly = true)
	public List<Appointment> getAppointmentEventsByEmployeeIdAndDate(Integer empId) {
		return appointmentDaoImpl.getAppointmentEventsByEmployeeIdAndDate(empId);
	}
	
	@Transactional(readOnly = true)
	public List<Appointment>getAppointmentEventsByEmployeeId(Integer empId,Integer parentId){
		return appointmentDaoImpl.getAppointmentEventsByEmployeeId(empId,parentId);
	}
}
